package com.huosu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huosu.domain.miner.ClassCompute;
import com.huosu.domain.miner.ComputeRule;
import com.huosu.mapper.ClassVideoMapper;
import com.huosu.mapper.ComputeMapper;
import com.huosu.service.IComputeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zhangjian
 * @since 2019-12-12
 */
@Service
@Slf4j
public class ComputeServiceImpl extends ServiceImpl<ComputeMapper, ClassCompute> implements IComputeService {

	@Resource
	private ComputeMapper computeMapper;

	@Override
	public List<ClassCompute> getClassCompute() {
		LambdaQueryWrapper<ClassCompute> lambdaQueryWrapper = Wrappers.lambdaQuery();
		lambdaQueryWrapper.eq(ClassCompute::getState, 1);
		lambdaQueryWrapper.orderByAsc(ClassCompute::getSort);

		return baseMapper.selectList(lambdaQueryWrapper);
	}

	@Override
	public List<ComputeRule> getClassComputeRule() {
		return computeMapper.getClassComputeRule();
	}

}
